package net.sourceforge.peers.sip.transactionuser;

import net.sourceforge.peers.Logger;

public class DialogStateEarly extends DialogState {
    
    public DialogStateEarly(String id, Dialog dialog, Logger logger) {
        super(id, dialog, logger);
    }
    
    @Override
    public void receivedOrSent101To199() {
        DialogState nextState = dialog.EARLY;
        dialog.setState(nextState);
    }
    
    @Override
    public void receivedOrSent2xx() {
        DialogState nextState = dialog.CONFIRMED;
        dialog.setState(nextState);
    }
    
    @Override
    public void receivedOrSent300To699() {
        DialogState nextState = dialog.TERMINATED;
        dialog.setState(nextState);
    }
    
    @Override
    public void receivedOrSentBye() {
        logger.error(id + " invalid transition");
        throw new IllegalStateException();
    }
}
